﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SQLTouch.Service.DataContracts;

namespace SQLTouch.Client.Metro
{
    public interface IFacade
    {
        event Action<DatabaseData> DatabaseAdded;
        event Action<DatabaseData> DatabaseUpdated;
        event Action<DatabaseData> DatabaseDeleted;

        event Action<QueryData> QueryAdded;
        event Action<QueryData> QueryUpdated;
        event Action<QueryData> QueryDeleted;

        IEnumerable<DatabaseData> GetDatabases();
        void AddDatabase(DatabaseData database);
        void UpdateDatabase(DatabaseData database);
        void DeleteDatabase(DatabaseData database);

        IEnumerable<QueryData> GetQueries();
        void AddQuery(QueryData query);
        void UpdateQuery(QueryData query);
        void DeleteQuery(QueryData query);

        void ShowAddDatabase();
        void ShowEditDatabase(DatabaseData database);
        void ShowDeleteDatabase(DatabaseData database);

        void ShowAddQuery(DatabaseData database);
        void ShowEditQuery(QueryData query);
        void ShowDeleteQuery(QueryData query);

        SchemaData GetSchema(string connectionString);
        QueryResultData GetQueryResult(string connectionString, QueryData query);

        void ShowUnexpectedError(string errorMessage);
        void ShowUnexpectedError(string errorMessage, Exception exception);

        void GoToHome();
        void GoToExplore(DatabaseData database);
    }
}
